package com.siss.tenancy.user.rocket;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.siss.tenancy.constant.RocketConst;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.util.Map;

@RocketMQMessageListener(topic = RocketConst.TOPIC_MESSAHE,consumerGroup = "test-group1")
@Component
public class ExampleLisebter implements RocketMQListener<Map<String, Object>> {
    @Override
    public void onMessage(Map<String, Object> message) {
        try {
            System.out.println(new ObjectMapper().writeValueAsString(message));
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
    }
}
